package com.group3.hospital.service.impl;

import com.group3.hospital.bean.User;
import com.group3.hospital.mapper.UserMapper;
import com.group3.hospital.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 秀秀
 */
@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;


    @Override
    public void regist(String username,String userPassword,Long userTel) throws Exception {
        userMapper.insertUser(username,userPassword,userTel);
    }

    @Override
    public User login(String username, Long userTel, String userPassword) throws Exception {
        return userMapper.queryUser(username,userTel,userPassword);
    }


    @Override
    public void update(User user) throws Exception {
        userMapper.update(user);
    }

    @Override
    public List<User> queryAll() throws Exception {
        return userMapper.queryAll();
    }

    @Override
    public void deleteById(Integer userId) throws Exception {
        userMapper.deleteById(userId);
    }

    @Override
    public User queryByName(String username) throws Exception {
        return userMapper.queryByName(username);
    }

    @Override
    public User queryById(Integer userId) throws Exception {
        return userMapper.queryById(userId);
    }
}
